home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / sharewar / FFE / GRAPH.SWG / 0038_Bitmap Distribution Format BDF.pas < prev    next >
Pascal/Delphi Source File  |  1997-05-11  |  9KB  |  241 lines

  1.                 Bitmap Distribution Format
  2.                         Version 2.1
  3.  
  4.                  MIT X Consortium Standard
  5.  
  6.                   X Version 11, Release 5
  7.  
  8.  
  9.                        March 18, 1994
  10.  
  11.  
  12. Copyright 1984, 1987, 1988 Adobe Systems, Inc.
  13.  
  14. Permission  to  use,  copy,  modify,  and  distribute   this
  15. software  and  its documentation for any purpose and without
  16. fee is hereby granted, provided that the above copyright no-
  17. tice  appear  in all copies and that both that copyright no-
  18. tice and this permission notice appear in  supporting  docu-
  19. mentation.
  20.  
  21. The Bitmap Distribution Format (BDF), Version 2.1, is an X
  22. Consortium standard for font interchange, intended to be
  23. easily understood by both humans and computers.
  24.  
  25.  
  26. File Format
  27.  
  28. Character bitmap information will be distributed in an
  29. USASCII-encoded, human-readable form.  Each file is encoded
  30. in the printable characters (octal 40 through 176) of
  31. USASCII plus carriage return and linefeed.  Each file con-
  32. sists of a sequence of variable-length lines.  Each line is
  33. terminated either by a carriage return (octal 015) and
  34. linefeed (octal 012) or by just a linefeed.
  35.  
  36. The information about a particular family and face at one
  37. size and orientation will be contained in one file.  The
  38. file begins with information pertaining to the face as a
  39. whole, followed by the information and bitmaps for the indi-
  40. vidual characters.
  41.  
  42. A font bitmap description file has the following general
  43. form, where each item is contained on a separate line of
  44. text in the file.  Tokens on a line are separated by spaces.
  45. Keywords are in upper-case, and must appear in upper-case in
  46. the file.
  47.  
  48. 1.   The word STARTFONT followed by a version number indi-
  49.      cating the exact file format used.  The version
  50.      described here is 2.1.
  51.  
  52. 2.   Lines beginning with the word COMMENT may appear any-
  53.      where between the STARTFONT line and the ENDFONT line.
  54.      These lines are ignored by font compilers.
  55.  
  56. 3.   The word FONT followed by either the XLFD font name (as
  57.      specified in part III) or some private font name.
  58.      Creators of private font name syntaxes are encouraged
  59.      to register unique font name prefixes with the X Con-
  60.      sortium to prevent naming conflicts.  Note that the
  61.      name continues all the way to the end of the line and
  62.      may contain spaces.
  63.  
  64. 4.   The word SIZE followed by the point size of the characters,
  65.      the x resolution, and the y resolution of the
  66.      device for which these characters were intended.
  67.  
  68. 5.   The word FONTBOUNDINGBOX followed by the width in x, height
  69.      in y, and the x and y displacement of the lower left corner
  70.      from the origin.  (See the examples in the next section.)
  71.  
  72. 6.   Optionally, the word STARTPROPERTIES followed by the
  73.      number of properties (p) that follow.
  74.  
  75. 7.   Then come p lines consisting of a word for the property
  76.      name followed by either an integer or string surrounded
  77.      by double-quote (octal 042).  Internal double-quote
  78.      characters are indicated by using two in a row.
  79.  
  80.      Properties named FONT_ASCENT, FONT_DESCENT, and
  81.      DEFAULT_CHAR should be provided to define the logical
  82.      font-ascent and font-descent and the default-char for
  83.      the font.  These properties will be removed from the
  84.      actual font properties in the binary form produced by a
  85.      compiler.  If these properties are not provided, a com-
  86.      piler may reject the font or may compute (arbitrary)
  87.      values for these properties.
  88.  
  89. 8.   The property section, if it exists, is terminated by
  90.      ENDPROPERTIES.
  91.  
  92. 9.   The word CHARS followed by the number of character seg-
  93.      ments (c) that follow.
  94.  
  95. 10.  Then come c character segments of the form:
  96.  
  97.      a.   The word STARTCHAR followed by up to 14 characters
  98.           (no blanks) of descriptive name of the glyph.
  99.  
  100.      b.   The word ENCODING followed by one of the following
  101.           forms:
  102.  
  103.           i.   <n> - the glyph index, that is, a positive
  104.                integer representing the character code used
  105.                to access the glyph in X requests, as defined
  106.                by the encoded character set given by the
  107.                CHARSET_REGISTRY-CHARSET_ENCODING font pro-
  108.                perties for XLFD conforming fonts.  If these
  109.                XLFD font properties are not defined, the
  110.                encoding scheme is font-dependent.
  111.  
  112.           ii.  -1 <n> - equivalent to form above.  This syn-
  113.                tax is provided for backward compatibility
  114.                with previous versions of this specification
  115.                and is not recommended for use with new
  116.                fonts.
  117.  
  118.           iii. -1 - an unencoded glyph.  Some font compilers
  119.                may discard unencoded glyphs, but, in gen-
  120.                eral, the glyph names may be used by font
  121.                compilers and X servers to implement dynamic
  122.                mapping of glyph repertoires to character
  123.                encodings as seen through the X protocol.
  124.  
  125.      c.   The word SWIDTH followed by the scalable width in
  126.           x and y of character.  Scalable widths are in
  127.           units of 1/1000th of the size of the character.
  128.           If the size of the character is p points, the
  129.           width information must be scaled by p/1000 to get
  130.           the width of the character in printer's points.
  131.           This width information should be considered as a
  132.           vector indicating the position of the next
  133.           character's origin relative to the origin of this
  134.           character.  To convert the scalable width to the
  135.           width in device pixels, multiply SWIDTH times
  136.           p/1000 times r/72, where r is the device resolu-
  137.           tion in pixels per inch.  The result is a real
  138.           number giving the ideal print width in device pix-
  139.           els.  The actual device width must of course be an
  140.           integral number of device pixels and is given in
  141.           the next entry.  The SWIDTH y value should always
  142.           be zero for a standard X font.
  143.  
  144.      d.   The word DWIDTH followed by the width in x and y
  145.           of the character in device units.  Like the
  146.           SWIDTH, this width information is a vector indi-
  147.           cating the position of the next character's origin
  148.           relative to the origin of this character.  Note
  149.           that the DWIDTH of a given ``hand-tuned'' WYSIWYG
  150.           glyph may deviate slightly from its ideal device-
  151.           independent width given by SWIDTH in order to
  152.           improve its typographic characteristics on a
  153.           display.  The DWIDTH y value should always be zero
  154.           for a standard X font.
  155.  
  156.      e.   The word BBX followed by the width in x (BBw),
  157.           height in y (BBh) and x and y displacment (BBox,
  158.           BBoy) of the lower left corner from the origin of
  159.           the character.
  160.  
  161.      f.   The optional word ATTRIBUTES followed by the
  162.           attributes as 4 hex-encoded characters.  The 
  163.           interpretation of these attributes is undefined in
  164.           this document.
  165.  
  166.      g.   The word BITMAP.
  167.  
  168.      h.   h lines of hex-encoded bitmap, padded on the right
  169.           with zeros to the nearest byte (that is, multiple
  170.           of 8).
  171.  
  172.      i.   The word ENDCHAR.
  173.  
  174. 11.  The file is terminated with the word ENDFONT.
  175.  
  176.  
  177. Metric Information
  178.  
  179. Figures 1 and 2 best illustrate the bitmap format and char-
  180. acter metric information.
  181.  
  182.  
  183. ED. NOTE:  The PostScript file named fig1.ps contains this figure.
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.           BBw = 9, BBh = 22, BBox = -2, BBoy = -6
  191.                         DWIDTH = 8 0
  192.                       SWIDTH] = 355 0
  193.              ``+'' = character origin and width
  194.  
  195.             Figure 1: An example of a descender
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203. ED.NOTE:  The PostScript file named fig2.ps contains this figure.
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.           BBh = 6, BBw = 4, BBox = +2, BBoy = +12
  211.                         DWIDTH = 5 0
  212.                        SWIDTH = 223 0
  213.  
  214. Figure 2: An example with the origin outside the bounding box
  215.  
  216.  
  217. An Example File
  218.  
  219. The following is an abbreviated example of a bitmap file
  220. containing the specification of two characters (the j and
  221. quoteright in figures 1 and 2).
  222.  
  223. STARTFONT 2.1 COMMENT This is a sample font in 2.1 format.
  224. FONT -Adobe-Helvetica-Bold-R-Normal--24-240-75-
  225. 75-P-65-ISO8859-1 SIZE 24 75 75 FONTBOUNDINGBOX 9 24 -2 -6
  226. STARTPROPERTIES 19 FOUNDRY "Adobe" FAMILY "Helvetica"
  227. WEIGHT_NAME "Bold" SLANT "R" SETWIDTH_NAME "Normal"
  228. ADD_STYLE_NAME "" PIXEL_SIZE 24 POINT_SIZE 240 RESOLUTION_X
  229. 75 RESOLUTION_Y 75 SPACING "P" AVERAGE_WIDTH 65
  230. CHARSET_REGISTRY "ISO8859" CHARSET_ENCODING "1" MIN_SPACE 4
  231. FONT_ASCENT 21 FONT_DESCENT 7 COPYRIGHT "Copyright (c) 1987
  232. Adobe Systems, Inc." NOTICE "Helvetica is a registered
  233. trademark of Linotype Inc." ENDPROPERTIES CHARS 2 STARTCHAR
  234. j ENCODING 106 SWIDTH 355 0 DWIDTH 8 0 BBX 9 22 -2 -6 BITMAP
  235. 0380 0380 0380 0380 0000 0700 0700 0700 0700 0E00 0E00 0E00
  236. 0E00 0E00 1C00 1C00 1C00 1C00 3C00 7800 F000 E000 ENDCHAR
  237. STARTCHAR quoteright ENCODING 39 SWIDTH 223 0 DWIDTH 5 0 BBX
  238. 4 6 2 12 ATTRIBUTES 01C0 BITMAP 70 70 70 60 E0 C0 ENDCHAR
  239. ENDFONT
  240.  
  241.